package com.yuexun.beilunpatient.ui.question.model.impl;

import com.yuexun.beilunpatient.base.BaseEntity;
import com.yuexun.beilunpatient.ui.question.api.QuestionApi;
import com.yuexun.beilunpatient.ui.question.bean.PatientQuestionBean;
import com.yuexun.beilunpatient.ui.question.bean.QuestionTypeBean;
import com.yuexun.beilunpatient.ui.question.model.IQuestionModel;
import com.yuexun.beilunpatient.utils.ApiUtil;

import java.util.Map;

import rx.Observable;

/**
 * Created by chenss on 2018/8/23.
 */
public class QuestionModel implements IQuestionModel {

    private QuestionApi api;

    //记录Log
//    private final Logger log = ProUtil.getLogger(LoginModel.class);

    public QuestionApi ApiInstance() {
        if (api != null) {
            return api;
        } else {
            return ApiUtil.getInstance().createRetrofitApi(QuestionApi.class);
        }
    }

    @Override
    public Observable<BaseEntity<PatientQuestionBean>> inquirePatientQuestionListPage(Map<String, String> praise) {
        api = ApiInstance();
        return api.inquirePatientQuestionListPage(praise);
    }

    @Override
    public Observable<BaseEntity<QuestionTypeBean>> inquirePatientQuestionTypeList(Map<String, String> praise) {
        api = ApiInstance();
        return api.inquirePatientQuestionTypeList(praise);
    }

    @Override
    public Observable<BaseEntity> createPatientQuestion(Map<String, String> praise) {
        api = ApiInstance();
        return api.createPatientQuestion(praise);
    }
}
